![]() |
PATH![]() |
![]() ![]() |
The following examples show the four basic forms for declaring variables and properties in AppleScript:
This statement declares a property and sets its initial value. The scope of a property declaration can be either a script object or an entire script. The value set by a property declaration is not reset each time the script is run; instead, it persists until the script is recompiled.
This global declaration is similar to a property declaration except that it doesn't set an initial value: The scope of a global variable declaration can be limited to specific handlers or script objects or can extend throughout an entire script. Like the value of a property, the value of a global variable is not reset each time a script is run. However, the value of a global variable must be set by other statements in the script.
You can use a Set command or the Copy command to set the value of any property or variable.If the variable has not been declared previously, the Set or Copy command declares it as a local variable.
This statement declares a local variable explicitly. Like a global declaration, an explicit local declaration doesn't set an initial value.